//
//  AMBaseResponseEntity.h
//  WeiDu_1_0
//
//  Created by foguo-mac-1 on 01/07/16.
//  Copyright (c) 2016 WeiDu Energy Tech. All rights reserved.
//

#import "HOBaseObject.h"
#import "HOBaseRequestEntity.h"
#import "HODefine.h"
typedef enum
{
	OPERATION_CLOSE,   //   关闭请求
	OPERATION_OK,  //   关闭请求
	OPERATION_REQUEST_AGAIN,  //提示再是请求
	OPERATION_LOGIN_AGAIN, //提示重新登录
	OPERATION_NETWORK_DOWN,//提示网络中断
	OPERATION_GO_BACK,//点击关闭返回
}
HO_ERROR_OPERATION;


@interface HOAPIError : NSObject
@property(nonatomic, retain)NSString *errorMessage;
@property(nonatomic, assign)HO_ERROR_OPERATION operation;
@property(nonatomic, retain)NSString               *internalErrMessage; //内部错误消息，提供给开发用的
@property(nonatomic, assign)AM_ERROR_CODE          errorCode;           //错误号
@end

@interface HOBaseResponseEntity : HOBaseObject
{
}

#pragma mark
@property(nonatomic, retain)NSDictionary           *jsonDic;            //服务器返回的json data(dic)
@property(nonatomic, assign)id                     dataNode;            //服务器返回的data 节点数据，类型不定
@property(nonatomic, retain)NSString               *action;             //请求标志


@property(nonatomic, retain)HOBaseRequestEntity    *baseRequest;        //请求实例
@property(nonatomic, retain)NSError                *error;              //错误
#pragma mark
@property(nonatomic, retain)NSMutableArray          *arrayData;         //the actually content of data node.
@property(nonatomic, retain)NSMutableDictionary     *dicData;           //the actually content of data node.
@property(nonatomic, retain)NSString                *strData;           //the actually content of data node.

@property(nonatomic, retain)HOAPIError                *apiError;

- (id)initWithRequest:(HOBaseRequestEntity *)request;

#pragma mark
- (void)verifyResponseData:(id)data withWithServiceType:(HO_SERVICE_TYPE)serviceType;
- (void)parseDicData:(NSDictionary *)dicData;
- (void)parseArrayData:(NSArray *)arrayData;

- (void)parseStringData:(NSString *)stringData;
- (HO_REQUEST_STATUS)getStatus;
- (BOOL)isRequestDone;

- (BOOL)isEqualAction:(NSString *)action;
- (BOOL)isValidatedArray:(NSArray *)array;
- (HO_ERROR_OPERATION)getOperation;
- (NSString *)getErrorMessage;
- (NSString *)getInternalErrorMessage;
- (void)setErrorMessage:(NSString *)content;
- (void)setInternalMessage:(NSString *)content;
- (void)setErrorCode:(AM_ERROR_CODE)errCode;
- (AM_ERROR_CODE)getErrorCode;

@end
